﻿namespace ConsoleAppString
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //string str = "Hello, World!";
            //string subStr1 = str.Substring(7); // "World!"
            //string subStr2 = str.Substring(7, 5); // "World"
            //Console.WriteLine(subStr1);
            //Console.WriteLine(subStr2);


            //string str = "ID,Name,Phone";
            //string[] parts = str.Split(',');

            //string str2 = "ID,Name,Phone";
            //string[] parts2 = str2.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            ////默认选项 (None)
            //string input = "a,,b,c,,d";
            //string[] parts = input.Split(',');

            //foreach (var part in parts)
            //{
            //    Console.WriteLine($"'{part}'");
            //}

            ////移除空条目 (RemoveEmptyEntries)
            //string input = "a,,b,c,,d";
            //string[] parts = input.Split(',', StringSplitOptions.RemoveEmptyEntries);

            //foreach (var part in parts)
            //{
            //    Console.WriteLine($"'{part}'");
            //}

            //string input = " a , , b , c , , d ";
            //string[] parts = input.Split(
            //    new char[] { ',' },
            //    StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries
            //);

            //foreach (var part in parts)
            //{
            //    Console.WriteLine($"'{part}'");
            //}

            //string str1 = "Hello";
            //string str2 = "World";
            //string result = string.Concat(str1, " ", str2, "1111"); // "Hello World"

            //Console.WriteLine(result);


            string[] parts = { "ID", "Name", "Phone" };
            string result = string.Join(",", parts);

            Console.WriteLine(result);
        }
    }
}
